/*
The vfs_info.h header file defines structures for the Virtual File System
*/

#ifndef _VFS_INFO_H
#define _VFS_INFO_H

#include <dev.h>

/* from lib files */
#include <types.h>

struct vfs_driver {
  int (*vfs_mount)(char *device, char *mount_point, int flags);
  int (*vfs_unmount)(char *device);
  int (*vfs_open)(int *fd, char *path, int mode);
  int (*vfs_close)(int *fd);
  int (*vfs_create)(char *path, int flags);
  int (*vfs_delete)(char *path);
  int (*vfs_read)(int fd, void *buf, size_t count);
  int (*vfs_write)(int fd, void *buf, size_t count);
  int (*vfs_walk)(int fd, char *path);
  int (*vfs_meta_read)(int fd, char *key, void *value, size_t count);
  int (*vfs_meta_write)(int fd, char *key, void *value, size_t count);
};

struct vfs_partition_info {
  dword_t major;               // device major number
  dword_t minor;               // device minor number
  byte_t type;                 // partition type (see MBR partition codes)
  dword_t first_block;         // first partition sector
  dword_t last_block;          // last partition sector
  struct vfs_driver *driver;   // pointer to driver functions to handle this partition
  void *custom;                // custom structure (driver dependent)
};

/* Functions prototypes */

#endif /* _VFS_INFO_H */
